import type { FaqVO, FaqForm, FaqQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
* 查询患者问答列表
* @param params
* @returns 患者问答列表
*/
export function faqList(params?: FaqQuery) {
  return requestClient.get<PageResult<FaqVO>>('/business/questions/list', { params });
}

/**
 * 导出患者问答列表
 * @param params
 * @returns 患者问答列表
 */
export function faqExport(params?: FaqQuery) {
  return commonExport('/business/questions/export', params ?? {});
}

/**
 * 查询患者问答详情
 * @param id id
 * @returns 患者问答详情
 */
export function faqInfo(id: ID) {
  return requestClient.get<FaqVO>(`/business/questions/${id}`);
}

/**
 * 新增患者问答
 * @param data
 * @returns void
 */
export function faqAdd(data: FaqForm) {
  return requestClient.postWithMsg<void>('/business/questions', data);
}

/**
 * 更新患者问答
 * @param data
 * @returns void
 */
export function faqUpdate(data: FaqForm) {
  return requestClient.putWithMsg<void>('/business/questions', data);
}

/**
 * 删除患者问答
 * @param id id
 * @returns void
 */
export function faqRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/business/questions/${id}`);
}
